package ru.amse.jsynchro.kernel.task;

public class TaskType {
    public static final int DIRECTED = 1;
    public static final int UNDIRECTED = 2;
    public static final int DIRECTEDDEL = 3;
    
    private final int type;
    
    public TaskType(String type) throws IllegalTypeException {
        this.type = getType(type);
    }
    
    public TaskType(int type) {
        this.type = type;
    }
    
    public int getType() {
        return type;
    }

    public static int getType(String type) throws IllegalTypeException {
        if ("-d".equals(type)) {
            return DIRECTED;
        } else if ("-dd".equals(type)) {
            return DIRECTEDDEL;
        } else if ("-u".equals(type)) {
            return UNDIRECTED;
        } else {
            throw new IllegalTypeException(type);
        }
    }

}
